<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$city=$this->model('city')->gocity($_RQ);
	$return['pcd']=$city['pcd'];
	$return['city']=$city;
	$return['pluginset']['searchkeyword']=$return['pluginset']['searchkeyword']?explode('|',$return['pluginset']['searchkeyword']):array('奶茶','一点点','炸鸡','麦当劳','奈雪','鸭脖');
	$return['member']=cfc('core')->get_member($_SESSION['uid']);
	$sharelink='jy_newpaimerch/search//cityid='.$_SESSION['cityid'].'&keyword='.trim($_RQ['keyword']).'&fromuser='.$_SESSION['uid'];
	$return['sharedata']=array(
			'title'=>$setting['share_title']?$setting['share_title']:'首页-商家联盟',
			'desc'=>$setting['share_desc']?$setting['share_desc']:'商家联盟，一个属于自己的消费联盟！',
			'link'=>custom_url($sharelink,true),
			'imgUrl'=>ATTACHMENT_URL.$setting['share_image']
	);
	//获取当前时间：
	$showtypetime1=mktime(10,30,0,date('m'),date('d'),date('Y'));
	$showtypetime2=mktime(14,00,0,date('m'),date('d'),date('Y'));
	$showtypetime3=mktime(17,00,0,date('m'),date('d'),date('Y'));
	$showtypetime4=mktime(21,00,0,date('m'),date('d'),date('Y'));
	if(TIMESTAMP<$showtypetime1){
		$return['showtype']=1;
	}elseif(TIMESTAMP>$showtypetime1 && TIMESTAMP<$showtypetime2){
		$return['showtype']=2;
	}elseif(TIMESTAMP>$showtypetime2 && TIMESTAMP<$showtypetime3){
		$return['showtype']=3;
	}elseif(TIMESTAMP>$showtypetime3 && TIMESTAMP<$showtypetime4){
		$return['showtype']=4;
	}elseif(TIMESTAMP>$showtypetime4){
		$return['showtype']=5;
	}
	foreach($return['pluginset']['bankuai'] as $kv=>&$bv){
		$groupids=str_array($bv['merchgroups']);
		if(count($groupids)>0){
			$bv['childs']=pdo_getall('jy_merch_category',array('id'=>$groupids,'uniacid'=>$_SESSION['uniacid']));
		}
	}
	$return['list']=array();
	$return['childs']=$return['allcate']=pdo_getall('jy_merch_category',array('uniacid'=>$_SESSION['uniacid']));
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($cid){
		$params['id']=$cid;
	}
	$return['merchgroups']=pdo_getall('jy_merch_category',$params);
	$return['setting']=array('hdps'=>$return['pluginset']['hdps'],'issearch'=>1,'bankuai1'=>$bankuai1,'bankuai3'=>$bankuai3);
	$return['params']=array('keyword'=>trim($_RQ['keyword']),'page'=>1,'cid'=>0,'pid'=>'all','getgoods'=>1);
	set_html('title',$basic['title']?:'商家联盟');
	exi($return);
}
?>